package com.ruoyi.system.domain.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import javax.validation.constraints.Min;
import java.util.List;

@Data
@TableName("room")
public class Room {
    @TableId(type = IdType.AUTO)
    private Long id;
    private String roomNumber;
    private String roomType;

    @TableLogic
    private Integer deleted;

    @Min(value = 1, message = "房间起码得有一个")
    private Integer capacity;

    // 房间中的老人列表(一对多)
    @TableField(exist = false)
    private List<Elder> elders;

    public boolean isFull(){
        return elders != null && elders.size() >= capacity;
    }

    public void setRoomId(Long id) {
        this.id = id;
    }

    public void setRoomName(String roomNumber) {
        this.roomNumber = roomNumber;
    }

    public void setRoomType(String roomType) {
        this.roomType = roomType;
    }

    public Long getId() {
        return id;
    }

    public Integer getCapacity() {
        return capacity;
    }

    public List<Elder> getElders() {
        return elders;
    }

    public String getRoomNumber() {
        return roomNumber;
    }

    public String getRoomType() {
        return roomType;
    }

    public void setElders(List<Elder> elders) {
        this.elders = elders;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public void setCapacity(Integer capacity) {
        this.capacity = capacity;
    }

    public void setRoomNumber(String roomNumber) {
        this.roomNumber = roomNumber;
    }
}